<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@include file="/webApp/head.jsp" %>
 <header data-am-widget="header" class="am-header am-header-default joan-head2 ">
       <div class="am-header-left am-header-nav">
        <a href="javascript:history.back()" class="">
            <i class="am-icon-chevron-left"></i>
        </a>
        </div>
    
        <h1 class="am-header-title">
            <a href="#title-link" class="">注册</a>
        </h1>
    
        <div class="am-header-right am-header-nav">
            
           <a href="/shoeHouse/home/main" class="">
                <i class="am-header-icon am-icon-home"></i>
            </a>
        </div>
  </header>

 


 
 
<div class="login">
        <form method="post" action="/home/registered" enctype="multipart/form-data">
            <ul class="login-ul reg-ul">
                <li class="login-li">
                 	<span>手机号码</span>
                    <input name="phone" placeholder="手机" class=" " type="tel" required="required">
                    <i class="am-icon-mobile"></i>
                 
                </li>
                  <li class="login-li">
                 	<span>用户名</span>
                    <input name="username" placeholder="用户名" class=" " required>
                    <i class="am-icon-mobile"></i>
                 
                </li>
                 <li class="login-li">
                 	<span>真实的姓名</span>
                    <input name="name" placeholder="真实的姓名" class=" " required>
                    <i class="am-icon-mobile"></i>
                 
                </li>
                  <li class="login-li">
                 	<span>地址</span>
                    <input name="address" placeholder="地址" class=" ">
                    <i class="am-icon-mobile"></i>
                 
                </li>
                  <li class="login-li">
                  <span>性别</span> 
          
     <!--  <label for="doc-select-1">性别</label> -->
      <select id="doc-select-1" name="sex">
        <option value="1">男</option>
        <option value="2">女</option>
      
      </select>

    </li>
                  <li class="login-li">
                 	<span>年龄</span>
                    <input name="age" placeholder="年龄" class=" ">
                    <i class="am-icon-mobile"></i>
                 
                </li>
                  <li class="login-li">
                 	<span>国家</span>
                    <input name="country" placeholder="国家" class=" ">
                    <i class="am-icon-mobile"></i>
                 
                </li>
                  <li class="login-li">
                 	<span>学校</span>
                    <input name="school" placeholder="学校" class=" ">
                    <i class="am-icon-mobile"></i>
                 
                </li>
                  <li class="login-li">
                 	<span>城市</span>
                    <input name="city" placeholder="城市" class=" ">
                    <i class="am-icon-mobile"></i>
                 
                </li>
                <li class="login-li">
                 	<span>登录密码</span>
                    <input name="password" placeholder="密码" class="">
                 	<i class="am-icon-unlock-alt"></i>
                </li>
           
            
             <li class="login-li">
                 	<span>上传头像</span>
                    <input type="file" name="file" id="doc-ipt-file-1">
                    <i class="am-icon-mobile"></i>
                   
                </li>
                
            </ul>
            
           <div class="login-btn">
            <!--  <input type="submit" class="am-btn am-btn-warning am-round mt20" value="注册"> -->
        	<a href="javascript:void(0)" onclick="registered()" class="am-btn am-btn-warning am-round mt20">注册</a> 
        </div>
        </form>
        
        
       
         


 </div>
   
  
  <script type="text/javascript">
function registered(){
	
	 var phone=$("input[name='phone']").val(); 
	
	 if(phone==""){
		 
		 alert("请输入手机号");
		 return;
	 }
	 var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
	 if(!myreg.test(phone)) 
	 { 
	     alert('请输入有效的手机号码！'); 
	     return; 
	 } 
	 var username=$("input[name='username']").val(); 
	 if(username==""){
		 alert("请输入用户名");
		 return;
	 }
	 var name=$("input[name='name']").val(); 
	 if(name==""){
		 alert("请输入姓名");
		 return;
	 }
	 var address=$("input[name='address']").val(); 
	 var sex=$("select[name='sex']").val(); 
	 var age=$("input[name='age']").val(); 
	 var country=$("input[name='country']").val(); 
	 var school=$("input[name='school']").val(); 
	 var city=$("input[name='city']").val(); 
	 var password=$("input[name='password']").val(); 
	
	 
	 if(address==""){
		
		 alert("请输入地址");
		 return;
	 }
	 if(sex==""){
		 alert("请选择性别");
		 return;
	 }
	 
	 if(age==""){
		 alert("请输入年龄");
		 return;
	 }
	 if(country==""){
		 alert("请输入国家");
		 return;
	 }
	 if(school==""){
		 alert("请输入学校");
		 return;
	 }
	 if(city==""){
		 alert("请输入城市");
		 return;
	 }
	 if(password==""){
		 alert("请输入密码");
		 return;
	 }

$('body > div > form').form('submit',{
	url : '/shoeHouse/home/registered',
	dataType : 'json',
	success : function(result) {
		var json = $.parseJSON(result);
		if (json.success == 0) {
			 $.messager.progress({
                 text : "注册成功,正在跳转到登录页面"
            });
			window.location.href = "/shoeHouse/home/login"; 
		} else if (json.success == 1) {
			alert("提示"+ json.msg);
		} else { 
			/* getTip("提示",json.msg,700); */
	          alert("提示"+json.msg);
		
		}
	}
});
}
</script>
   

 
  
   	
     


<script src="js/jquery.min.js"></script>
<script src="js/amazeui.min.js"></script>


<body>